package com.larry.rabbitmq.sisth;

import com.larry.rabbitmq.util.RabbitMQUtils;
import com.rabbitmq.client.Channel;

import java.util.Scanner;

/**
 * @author larry
 * @Title: larry-rabbitmq
 * @Package com.larry.rabbitmq.sisth
 * @Description: 发消息
 * @date 6/30/2110:39 AM
 */
public class DirectLogs {

    //交换机名字
    public static final String EXCHANGE_NAME = "direct_logs";

    public static void main(String args[]) throws Exception {
        Channel channel = RabbitMQUtils.getChannel();

        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            String message = scanner.next();
            channel.basicPublish(EXCHANGE_NAME, "info", null, message.getBytes());
            System.out.println("发出消息.....: " + message);
        }

    }
}